//
//  ViewController.m
//  PlayCatchGame
//
//  Created by 流言 on 2018/1/12.
//  Copyright © 2018年 清正. All rights reserved.
//

#import "HomeTabBarVC.h"

#import "LoginViewController.h"

#import "HomeViewController.h"
#import "RankListViewController.h"
#import "CircleViewController.h"
#import "MyInfoViewController.h"

@interface HomeTabBarVC ()

@end

@implementation HomeTabBarVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.tabBar.tintColor =APP_DEFAULT_COLOUR;

    [self showDefaultVCWidthIndex:0 navArray:[self creactBarRootViewController]];
}

- (NSMutableArray *)creactBarRootViewController {
    NSMutableArray *navVCs =[NSMutableArray array];
    
    HomeViewController *homeVC =[[HomeViewController alloc]init];
    homeVC.title =@"娃娃";
    BaseNavController *homeNav =[[BaseNavController alloc]initWithRootViewController:homeVC];
    homeNav.tabBarItem.title =@"首页";
    [homeNav.tabBarItem setSelectedImage:[[UIImage imageNamed:@"zhuye-dianji"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [homeNav.tabBarItem setImage:[[UIImage imageNamed:@"zhuye-moren"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [navVCs addObject:homeNav];
    
    RankListViewController *rankListVC =[[RankListViewController alloc]init];
    rankListVC.title =@"排行榜";
    BaseNavController *rankListNav =[[BaseNavController alloc]initWithRootViewController:rankListVC];
    rankListNav.tabBarItem.title =@"排行榜";
    [rankListNav.tabBarItem setImage:[[UIImage imageNamed:@"paihangbang-moren"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [rankListNav.tabBarItem setSelectedImage:[[UIImage imageNamed:@"paihangbang-dianji"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [navVCs addObject:rankListNav];
    
    CircleViewController *circleVC =[[CircleViewController alloc]init];
    circleVC.title =@"圈子";
    BaseNavController *circleNav =[[BaseNavController alloc]initWithRootViewController:circleVC];
    circleNav.tabBarItem.title =@"圈子";
    [circleNav.tabBarItem setImage:[[UIImage imageNamed:@"quanxi-moren"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [circleNav.tabBarItem setSelectedImage:[[UIImage imageNamed:@"quanxi-dianji"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [navVCs addObject:circleNav];
    
    MyInfoViewController *infoVC =[[MyInfoViewController alloc]init];
    infoVC.title =@"";
    BaseNavController *infoNav =[[BaseNavController alloc]initWithRootViewController:infoVC];
    infoNav.tabBarItem.title =@"我的";
    [infoNav.tabBarItem setImage:[[UIImage imageNamed:@"wode-moren"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [infoNav.tabBarItem setSelectedImage:[[UIImage imageNamed:@"wode-dianji"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [navVCs addObject:infoNav];
    
    return navVCs;
}

- (void)showDefaultVCWidthIndex:(NSInteger)selectIndex navArray:(NSMutableArray *)navArray {
    [self setViewControllers:navArray animated:NO];
    self.selectedIndex =selectIndex;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
